package com.ttbj.controller.zwpay;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ttbj.api.dto.Page;
import com.ttbj.api.dto.zwpay.ZwPayDto;
import com.ttbj.api.zwpay.ZwPayService;
import com.ttbj.util.ViewDataUtil;
/**
 * 支付宝、微信支付信息controller
 */
@Controller
public class ZwPayController {
	
	@Autowired
	private ZwPayService zwPayService;
	
	/**
	 * 支付宝、微信支付信息页面
	 * @return
	 */
	@RequestMapping(value="/zwpay/zwpay_info.htm")
	public String zwpay_info() {
		return "zwpay/zwpay_info";
	}
	
	
	/**
	 * 分页条件查询支付宝、微信支付完成的列表 
	 * @param orderNum 订单编号
	 * @param page 分页信息
	 * @return
	 */
	@RequestMapping(value="/zwpay/getZwPayInfoByPage.htm", method=RequestMethod.POST, produces={"text/html;charset=UTF-8;","application/json;"})
	@ResponseBody
	public String getZwPayInfoByPage(@RequestParam(required=false) String orderNum, Page page) {
		List<ZwPayDto> zwPayDtos = this.zwPayService.findZwPayInfoByPage(orderNum, page);
		int count = 0;
		if (null != zwPayDtos) {
			count = this.zwPayService.findZwPayInfoBypageCount(orderNum);
		}
		return ViewDataUtil.buildSuccessPageJson("支付信息", zwPayDtos, count);
	}
}
